import java.util.Stack;

public class Test {
}
class MyQueue1 {



    //栈实现队列
    Stack<Integer> stack1;
    Stack<Integer> stack2;
    public MyQueue1() {

    }

    public void push(int x) {
        //尾插
        stack1.push(x);
    }

    //头出
    public int pop() {
        if(stack2.size()==0) {
            while (stack1.size()!=0) {
                stack2.push(stack1.pop());
            }
        }
        return stack2.pop();
    }

    public int peek() {
        if(stack2.size()==0) {
            while (stack1.size()!=0) {
                stack2.push(stack1.pop());
            }
        }
        return stack2.peek();
    }

    public boolean empty() {
        return stack1.size()==0;
    }
}
